import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_cookbook/test_widget/myWidget.dart';

/// Introduction Widget
/// 1. 添加flutter_test依赖
/// 2. 创建Widget测试
/// 3. 创建testWidgets测试
/// 4. 使用WidgetTester建立Widget
/// 5. 使用Finder查找Widget
/// 6. 使用Matcher验证Widget

/// flutter test test/test_widget/introductionWidget.dart
void main() {
  testWidgets('MyWidget has a title and message', (WidgetTester tester) async {
    await tester.pumpWidget(MyWidget(title: 'T', message: 'M'));

    final titleFinder = find.text('T');
    final messageFinder = find.text('M');

    expect(titleFinder, findsOneWidget);
    expect(messageFinder, findsOneWidget);
  });
}
